<script>
    
$(document).ready(function() {    
    $( ".useritem, .addEmoloyeeBack" ).click(function() { 
         var url = $(this).attr('url');         
         $('#txtEmployeeId').val($(this).attr('rel'));    
         $('#frmCompanyCode').attr('action', url);  
         $( "#frmCompanyCode" ).submit();   
       
    });
 }); 
</script>
<form id="frmCompanyCode" action="" method="POST">
  <input type="hidden" id="txtEmployeeId" name="txtEmployeeId">      
</form>

<div id="main_content" class="updateSalaryInfo">
    <h3><?php echo $title; ?></h3>
    <a rel="<?php echo $id ?>" url="<?php echo base_url('/employee/bonus' ); ?>" href="javascript:void(0);"  class="btn addEmoloyeeBack m10"><?php echo $btnBack; ?></a>
    <div class="form_add">   
        <form action="" method="post">
            <table border="0" class="add_data">
                <tr>
                    <td align="right"><label><?php echo $lblemployeeName; ?></label></td>
                    <td><label><a rel="<?php echo $id ?>" url="<?php echo base_url('/employee/update' ); ?>" href="javascript:void(0);" class="useritem"><?php echo dQuotes(subString($employeeName,15)); ?></a></label></td>
                    <td></td>
                </tr>
                <tr>
                    <td align="right"><label><?php echo $lblApplyDate; ?> <font color="#FF0000">(*)</font></label></td>
                    <td>
                        <input type="hidden" id="EmployeebonusId" name="txtEmployeebonusId" value="<?php if(isset($EmployeebonusId)){echo $EmployeebonusId;} ?>">
                        <input type="hidden" id="txtApplyDateOld" name="txtApplyDateOld" value="<?php if(isset($txtApplyDate)){echo strtotime($txtApplyDate . '/1');} ?>">
                        <input type="hidden" name="txtEmployeeId" class="txtEmployeeId" value="<?php echo $id; ?>">
                        <input  type="text" name="txtApplyDate" class="datepicker" maxlength="7" value="<?php if(isset($txtApplyDate)){echo $txtApplyDate;} ?>" size="20" />
                        &nbsp;&nbsp;<?php echo $this->lang->line('emp_bu_formatDate');?>
                        &nbsp;&nbsp;<span class="error"><?php echo form_error('txtApplyDate'); ?></span>
                    </td>
                </tr>
                <tr>
                    <td align="right"><label><?php echo $lblBonus; ?> <font color="#FF0000">(*)</font></label></td>
                    <td>
                        <input  type="text" name="txtBonus"  maxlength="6" value="<?php if(isset($txtBonus)){echo $txtBonus;} ?>" size="20" />
                        &nbsp;&nbsp;<?php echo $this->lang->line('emp_bu_USD');?>
                        &nbsp;&nbsp;<span class="error"><?php echo form_error('txtBonus'); ?></span>
                    </td>
                </tr>
                <tr>
                    <td align="right"><label><?php echo $lblBonusInfo; ?></label></td>
                    <td>
                        <textarea class="txtDescription" name="txtBonusInfo" rows="5" cols="60" maxlength="255"><?php if(isset($txtBonusInfo)){echo $txtBonusInfo;} ?></textarea>
                        <br><span class="error"><?php echo form_error('txtBonusInfo'); ?></span>
                    </td>
                </tr>  
                <?php if(isset($EmployeebonusId) && !empty($EmployeebonusId)){ ?>
                <tr>
                    <td align="right"><?php echo $this->lang->line('spl__Delete');?></td>
                    <td><input type="checkbox" <?php echo ($chkDelete==1) ? 'checked' : ''?> name="chkDelete" /></td>
                </tr>
                <?php } ?>
                <tr>
                    <td align="left"><input type="submit" name="btnSubmit" value="<?php echo $btnSubmit; ?>"></td>            
                    <td></td>
                    <td></td>
                </tr>                                                                                         
            </table> 
        </form>
    </div>
</div>
<!-- BEGIN dialog message -->
<div id="dialog" title="<?php echo $dialogTitle; ?>">
    <?php echo isset($message) ? $message : ''; ?>
</div>
<!-- END dialog message -->
<script type="text/javascript">
    $(document).ready(function() {
        $(function() {
            $(".datepicker").datepicker({
                dateFormat: 'yy/mm',
                showOn: "button",
                buttonImage: "<?php echo base_url(); ?>/public/sites/images/calendaricon.gif",
                buttonImageOnly: true,
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                closeText: '<?php echo $this->lang->line('MC018'); ?>',
                yearRange: '<?php echo $minYear . ':' . $maxYear; ?>',
                defaultDate: new Date(<?php echo $txtDateYear; ?>,<?php echo $txtDateMonth; ?>,1),
                onClose: function(dateText, inst) {
                    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                    $(this).datepicker('setDate', new Date(year, month, 1));
                }
            });
        });        
<?php if (isset($flag) && $flag == TRUE): ?>
            $(function() {
                $("#dialog").dialog({
                    modal: true,
                    close: function() {
                            $('#txtEmployeeId').val('<?php echo $id ?>');       
                            $('#frmCompanyCode').attr('action', '<?php echo base_url();?>employee/bonus');  
                            $( "#frmCompanyCode" ).submit();
                    },
                    buttons: [{
                        text: "<?php echo $this->lang->line('MC019');?>",
                        click: function() {
                            $('#txtEmployeeId').val('<?php echo $id ?>');       
                            $('#frmCompanyCode').attr('action', '<?php echo base_url();?>employee/bonus');  
                            $( "#frmCompanyCode" ).submit();
                        },
                    }]
                });
            });
<?php elseif (isset($flag) && $flag == FALSE): ?>
            $(function() {
                $("#dialog").dialog({
                buttons: [
                    { text: "<?php echo $this->lang->line('MC019');?>", click: function() { $( this ).dialog( "close" ); } }
                ]
                });
            });
<?php endif; ?>
    });
</script>
<style>
    .ui-datepicker-calendar{
        display: none;
    }
</style>